home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / WINER.ZIP / GETNAMES.BAS < prev    next >
BASIC Source File  |  1992-05-13  |  917b  |  26 lines

  1. '********** GETNAMES.BAS - demonstrates the GetNames file name reading routine
  2.  
  3. 'Copyright (c) 1992 Ethan Winer
  4.  
  5. DEFINT A-Z
  6. DECLARE FUNCTION GetNames% (Array$())   'all functions must be declared
  7. DECLARE SUB Sort (Array$(), Direction)
  8.  
  9. Spec$ = "C:\QB45\*.BAS"         'this is the file spec -- edit as necessary
  10. REDIM Array$(1 TO 1)            'we must establish the array as dynamic
  11. Array$(1) = Spec$               'place it into the first array element
  12.  
  13. NumFiles = GetNames%(Array$())  'fill the array with the matching names
  14. CALL Sort(Array$(), 0)          'now sort the array before displaying it
  15.  
  16. CLS
  17. FOR X = 1 TO NumFiles           'for each name that was found
  18.   PRINT Array$(X)               'print it
  19.   IF LEN(INKEY$) THEN           'pause if a key is pressed
  20.     WHILE INKEY$ = "": WEND     'until another key is pressed
  21.   END IF
  22. NEXT
  23.  
  24. PRINT
  25. PRINT NumFiles; "files matched "; Spec$
  26.